package cn.wolfcode.trip.base.domain;

import com.alibaba.fastjson.JSON;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;
import java.util.HashMap;


/**
 * 游记
 */
@Setter
@Getter
public class Travel {

    public static final int STATE_COMMON = 0;  //普通状态(草稿)
    public static final int STATE_WAIT = 1;  //待发布状态
    public static final int STATE_RELEASE = 2;  //已发布状态
    public static final int STATE_REJEST = -1;  //拒绝状态

    //点评(有多少人点评这篇游记)
    private Integer commentNum;

    //点赞(有多少人给这篇游记点赞)
    private Integer likeNum;

    private Long id;
    //标题
    private String title;
    //旅游时间
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date travelTime;
    //人均消费
    private String perExpends;
    //旅游天数
    private Integer days;
    //和谁旅游1.一个人  2.和父母  3.和朋友  4.和同事  5.和爱人  6.和其他
    private Integer person;
    //作者
    private User author;
    //创建时间
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date createTime;
    //发布时间
    private Date releaseTime;
    //是否公开
    private Boolean isPublic;
    //旅游地区
    private Region place;
    //封面
    private String coverUrl;
    //最后更新时间
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date lastUpdateTime;
    //状态
    private int state;

    //游记内容
    private TravelContent travelContent;


    public String getJsonString(){
        HashMap<Object,Object> map = new HashMap();
        map.put("id",id);
        map.put("title",title);
        map.put("coverUrl",coverUrl);

        return JSON.toJSONString(map);

    }

}